package com.hzcx.app.simplechat.ui.chat.adapter;

import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.hzcx.app.simplechat.R;
import com.hzcx.app.simplechat.ui.chat.bean.GdMapPoiBean;

import java.util.List;

public class GdMapPoiAdapter extends BaseQuickAdapter<GdMapPoiBean, BaseViewHolder> {

    private int pos=-1;

    public GdMapPoiAdapter(@Nullable List<GdMapPoiBean> data) {
        super(R.layout.rv_item_location_poi,data);
    }

    @Override
    protected void convert(BaseViewHolder helper, GdMapPoiBean item) {
        helper.setText(R.id.tv_title,item.getTitle());
        helper.setText(R.id.tv_address,item.getDistance()+"  |  "+item.getAddress());

        if(helper.getAdapterPosition()==pos){
            helper.setVisible(R.id.iv_select,true);
        }else {
            helper.setVisible(R.id.iv_select,false);
        }
    }

    public void setPos(int pos){
        this.pos=pos;
        notifyDataSetChanged();
    }

    public int getPos(){
        return pos;
    }
}
